package com.qf.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置拦截器拦截哪些路径
 */
@Configuration   // 配置类的专用注解
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private ApiContInterceptor apiContInterceptor;

    @Autowired
    private TimeInterceptor timeInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(apiContInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/apicount");

        registry.addInterceptor(timeInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/apicount","/xxx");

    }
}
